import { get, post } from "./index";

interface DatasetItem {
    createTime: string;
    id: number;
    name: string;
    size: string;
}
// 获取数据集
export const getDatasetList = async () => {
    const res = await post("/dataset/private/list", {
        pageSize: -1,
    });
    const list: DatasetItem[] = res.data?.dataSetPrivateDtoList || [];
    return list;
};

// 获取数据集详情
export interface DatasetFileListQuery {
    dataSetId: number;
    page: number;
    pageSize: number;
    parentId: number;
}
export const getDatasetfileList = async (params: DatasetFileListQuery) => {
    const res = await post("/datasetfile/list", params);
    const { total, dataSetFileListDtoList: list, filePath } = res.data || {};
    return {
        total,
        list,
        filePath,
    };
};

// 标注任务列表
export interface MarktaskFileListQuery {
    id: number;
    page: number;
    pageSize: number;
    parentId: number;
}
export const getMarktaskFileList = async (params: MarktaskFileListQuery) => {
    const res = await post("/marktask/file/list", params);
    const { total, maskTaskFileListDtoList: list } = res.data || {};
    return {
        total,
        list,
    };
};

// 更新文件是否完成人工标注状态
export interface NeedMarkStatusParams {
    id: number;
    needMarkStatus: number;
    taskId: number;
}
export const updateFileMarkStatus = async (params: NeedMarkStatusParams) => {
    const res = await post("/marktask/updateFileMarkStatus", params);
    return res;
};

// 更新文件是否完成预标注状态
export interface PreMarkStatusParams {
    id: number;
    preMarkStatus: number;
    taskId: number;
}
export const updateFilePreMarkStatus = async (params: PreMarkStatusParams) => {
    const res = await post("/marktask/updateFilePreMarkStatus", params);
    return res;
};
